package com.ycsj.goldmedalnewconcept.teacher.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ycsj.goldmedalnewconcept.R;
import com.ycsj.goldmedalnewconcept.teacher.bean.PetRankInfo;

import java.util.List;

/**
 * 宠物排名的列表适配器
 * Created by Administrator on 2019/4/3 0003.
 */

public class PetRankRvAdapter extends BaseQuickAdapter<PetRankInfo.DataBean, BaseViewHolder> {
    public PetRankRvAdapter(int layoutResId, @Nullable List<PetRankInfo.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PetRankInfo.DataBean item) {


        //排名
        TextView tvNum = helper.getView(R.id.tv_num);
        tvNum.setText((helper.getLayoutPosition() + 1) + "");

        //姓名
        TextView tvName = helper.getView(R.id.tv_name);
        tvName.setText(item.getName());

        //等级
        TextView tvLevle = helper.getView(R.id.tv_levle);

        if (!TextUtils.isEmpty(item.getLevel())) {
            tvLevle.setText("LV." + item.getLevel());
        } else {
            tvLevle.setText("未领取宠物");
        }


    }
}
